
<template>
  <RouterView />
</template>

<script setup lang="ts">
import { useBeforeunload } from '@/hooks/useBeforeunload';
import thingSocket from './utils/thingSocket';
import { onUnmounted, onMounted } from 'vue';



// 浏览器刷新时关闭websocket
useBeforeunload(thingSocket.close)



onMounted(() => {
  // thingSocket.init((data: any) => {
  //       if (data && JSON.parse(data)) {
  //         data = JSON.parse(data)
  //         handleSocketMessage(data.data)
  //       };
  //     });
});


onUnmounted(() => {
  thingSocket.close()
})
</script>

<style lang="scss" scoped></style>
